<template>
	<layout :loading="loading" curPage="station" title="点位详情">

		<view class="layui-form">
			
			<inputGroup :disabled="true" text title="点位名称" :value="data.name" ></inputGroup>
			
			<view @tap="chooseLocation">
				<inputGroup :disabled="true" text title="经纬度" :value="`${data.longitude}°,${data.latitude}°`" addOn="查看位置"></inputGroup>
			</view>
			
			<inputGroup :disabled="true" text title="状态" :value="data.statusStr" ></inputGroup>
			
			<inputGroup :disabled="true" text title="类型" :value="data.typeStr" ></inputGroup>
			
			<inputGroup :disabled="true" text title="控制级别" :value="data.controlLevel" ></inputGroup>
			
			<inputGroup :disabled="true" text title="许可证编号" :value="data.licenseNum" ></inputGroup>
			
			<inputGroup :disabled="true" text title="监控编码" :value="data.monitorNum" ></inputGroup>
			
			<inputGroup v-if="data.type == 2" :disabled="true" text title="设计排放量" :value="data.emissions" ></inputGroup>
			
			<inputGroup :disabled="true" text title="排放依据" :value="data.emissionReference" ></inputGroup>
			
			<inputGroup v-if="data.type == 2" :disabled="true" text title="排气筒高度" :value="data.height" addOn="米"></inputGroup>
			
			<inputGroup :disabled="true" text title="采样位置" :value="data.samplingLocation" ></inputGroup>
			
			<inputGroup v-if="data.type == 2" :disabled="true" text title="流速测量位置" :value="data.velocityMeasurement" ></inputGroup>
			
			<inputGroup v-if="data.type == 2" :disabled="true" text title="测流位置截面积" :value="data.measuringSection" addOn="㎡"></inputGroup>
			
			<inputGroup :disabled="true" text title="采样方式" :value="data.samplingType" ></inputGroup>
			
			<inputGroup :disabled="true" text title="输送距离" :value="data.distance" addOn="米"></inputGroup>
			
			<inputGroup v-if="data.type == 2" :disabled="true" text title="稀释法稀释比" :value="data.dilutionRate" addOn="%"></inputGroup>
			
			<inputGroup v-if="data.type == 2" :disabled="true" text title="稀释气流量或压力" :value="data.gasFlow" ></inputGroup>
			
			<inputGroup v-if="data.type == 2" :disabled="true" text title="样品气流量或压力" :value="data.samplingPressure" ></inputGroup>
			
			<inputGroup v-if="data.type == 1" :disabled="true" text title="排放去向" :value="data.dischargeDirection" ></inputGroup>
			
			<inputGroup v-if="data.type == 1" :disabled="true" text title="设计处理能力" :value="data.dealCapacity" ></inputGroup>
			
			<inputGroup v-if="data.type == 1" :disabled="true" text title="排放方式" :value="data.emissionMode" ></inputGroup>
			
			<inputGroup v-if="data.type == 1" :disabled="true" text title="堰槽类型" :value="data.modeType" ></inputGroup>
			
			<inputGroup v-if="data.type == 1" :disabled="true" text title="喉道宽度或管径" :value="data.width" addOn="cm"></inputGroup>
			
			<inputGroup v-if="data.type == 1" :disabled="true" text title="测流段长度" :value="data.dischargeLength" addOn="米"></inputGroup>
			
			<inputGroup :disabled="true" text title="企业名称" :value="data.companyName" ></inputGroup>
			
			<inputGroup :disabled="true" text title="运维人员" :value="data.staffName1" ></inputGroup>
			
			<inputGroup :disabled="true" text title="运维公司" :value="data.servicerName2" ></inputGroup>
			
			
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn layui-btn-primary" @click="kit.goBack('index')">返回</button>
				</div>
			</div>
		</view>

	</layout>
</template>

<script>
	export default {
		data() {
			return {
				loading: true ,
				data : {
					id : ''
				}
			}
		},
		onLoad(params) {
			this.data.id = params.id || "" ;
		},
		onShow() {
			this.loadData();
		},
		methods: {
			
			loadData : function(e){
				var that = this ;
				var data = {
					id : this.data.id
				} ;
				this.kit.get("/admin/station/detail",data,function(res){
					that.data = res.data || that.data ;	
					that.loading  = false ;
				});
			},
			
			chooseLocation:function(e){
				console.log(e);
				uni.openLocation({
					latitude:this.data.latitude,
					longitude:this.data.longitude,
					name : this.data.name
				})
			},
		}
	}
</script>